#include"RoleServer.h"
#include<iostream>
#include"Md5.h"
#include"Parse.h"
#include"Role.h"



void testMd5() {
	string a = _md5("salt=xV8v4Qu54lUKrEYFZkJhB8cuOh9Asafs&t=1650452590&r=952225&b=&q=role_id=166849464&server=cn_gf01");
	std::cout << a;

}

void roleTest() {

	RoleServer role;
	Value paramter;
	paramter["role_id"] = "166849464";
	paramter["server"] = "cn_gf01";
	role.setUrl(1, paramter);
	Response list = role.getRoleList();
	string body = list.text;
	Value data = Parse::json(body.c_str());
	const Value roles = data["data"]["avatars"];
	for (int i = 0; i < roles.size(); i++) {
		Role role;
		role.name = roles[i]["name"].asCString();
		role.img_url = roles[i]["image"].asCString();
	}
}

int main() {
	roleTest();
	std::cin;
	return 0;
}